document.addEventListener('DOMContentLoaded', function() {
    console.log('Popup script loaded');
  document.getElementById('extractBtn').addEventListener('click', function() {
    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
    //   chrome.scripting.executeScript({
    //     target: {tabId: tabs[0].id},
    //     files: ['content.js']
    //   });
    // console.log(tabs, 'tabs[0].id');
      chrome.scripting.executeScript({ 
        target: {tabId: tabs[0].id},
        func: ()=>{
            extractSkeleton();
        }
      });
    });
  });
  document.getElementById('download').addEventListener('click', function() {
    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
      chrome.scripting.executeScript({ 
        target: {tabId: tabs[0].id},
        func: () => downloadHtml(),
      });
    });
  });
});